package de.dhbw.minf12.mas.logic;

import de.dhbw.minf12.mas.Permutation;

/**
 * Producer Zielfunktion, optimiert durchschnittliche Fertigstellungszeit.
 * @author flo
 *
 */
public class ProducerLogic extends AbstractTargetFunctionLogic {

	public ProducerLogic(int[][] pT) {
		super(pT);
	}
	
	@Override
	public int calculateSolutionValue(Permutation pPermutation) {
		int solutionValue = this.tSum;
		
		int permJobCount = pPermutation.size();
		
		for(int i = 2; i <= permJobCount; i++){
			solutionValue += (permJobCount + 1 - i) * this.d[pPermutation.get(i - 2)][pPermutation.get(i - 1)];
		}
		
		return solutionValue;
	}
}
